#include "stdafx.h"
#include "Satellite_common.h"
 
 NetworkData getNextSatLocationFromFile()
 {
 	const string filename = "./resources/Satellites/satLocation.txt";
 
 	static ifstream fin(filename.c_str());
 
 	static SATLOCATION loc;
 
 	loc.mesg_head = 100;
 
 	if (!fin.eof())
 	{
 		fin >> loc.num
 			>> loc.name
 			>> loc.x
 			>> loc.y
 			>> loc.z
 			>> loc.lon
 			>> loc.lat
 			>> loc.alt
 			>> loc.max_angle
 			>> loc.min_angle
 			>> loc.max_elev
 			>> loc.min_elev;
 	}
 	else
 	{
 		loc.num = -1;
 		memset(loc.name, 0, sizeof(loc.name));
 		loc.x = 0;
 		loc.y = 0;
 		loc.z = 0;
 		loc.lon = 0;
 		loc.lat = 0;
 		loc.alt = 0;
 		loc.max_angle = 0;
 		loc.min_angle = 0;
 		loc.max_elev = 0;
 		loc.min_elev = 0;
 	}
 
	NetworkData data;
	data.mesg_head = loc.mesg_head;
	data.data = (char*)&loc;

	return data;
 }
